<blockquote class="layui-elem-quote">{$title}</blockquote>
<form class="layui-form layui-form-pane" action="" style="width: 50%;">
    <div class="layui-form-item">
        <div class="layui-upload">
            <button type="button" class="layui-btn" id="test2">上传居中水印图</button>
            <div class="layui-upload-list" style="width: 100px">
                <input type="hidden" name="center" id="center" value="{$dataInfo.center|default=''}" placeholder="请上传居中水印图">
                <img class="layui-upload-img" id="center_img" src="{$dataInfo.center|default=''}">
            </div>
        </div>
        <div class="layui-upload">
            <button type="button" class="layui-btn" id="test1">上传右下角水印图</button>
            <div class="layui-upload-list"  style="width: 350px;height: 110px;">
                <input type="hidden" name="right" id="right" value="{$dataInfo.right|default=''}" placeholder="请上传右下角水印图">
                <img class="layui-upload-img" id="right_img" src="{$dataInfo.right|default=''}">
            </div>
        </div>
        <div class="layui-form-item" pane="">
            <label class="layui-form-label">水印开关</label>
            <div class="layui-input-block">
                <input type="checkbox" name="switch" lay-skin="switch" lay-text="开启|关闭" value="1" {present name="dataInfo.switch"}{if condition="$dataInfo['switch'] == '1'"}checked{/if}{/present} >
            </div>
        </div>
        <div class="layui-form-item">
            <button class="layui-btn" type="button" lay-submit lay-filter="formDemo">立即提交</button>
        </div>
    </div>
</form>
<script>
    layui.use(['form','upload'], function(){
        var form = layui.form,upload = layui.upload;
        form.render();
        //监听提交
        form.on('submit(formDemo)', function(data){
            post_sub("{:url('Systems/drawingUploadSystem')}",data.field);
            return false;
        });
        //上传居中水印图
         upload.render({
            elem: '#test2'
            ,url: "{:url('FileOperation/uploadImg',['type'=>'drawingUploadSystem'])}"
            ,before: function(obj){
                UploadIndex = layer.msg('图片上传中', {
                    icon: 16
                    ,shade: 0.01
                    ,time:0
                });
            }
            ,done: function(res){
                layer.close(UploadIndex);
                layer.msg(res.msg);
                //如果上传失败
                if(parseInt(res.code) == 0){
                    //上传成功-默认赋值
                    $("#center").val(res.url);
                    $("#center_img").attr("src",res.url);
                }
            }
        });
        //上传居中水印图
        upload.render({
            elem: '#test1'
            ,url: "{:url('FileOperation/uploadImg',['type'=>'drawingUploadSystem'])}"
            ,before: function(obj){
                UploadIndex = layer.msg('图片上传中', {
                    icon: 16
                    ,shade: 0.01
                    ,time:0
                });
            }
            ,done: function(res){
                layer.close(UploadIndex);
                layer.msg(res.msg);
                //如果上传失败
                if(parseInt(res.code) == 0){
                    //上传成功-默认赋值
                    $("#right").val(res.url);
                    $("#right_img").attr("src",res.url);
                }
            }
        });
    });
</script>